﻿package mortal.component.gLinkText
{
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class GLinkTextData extends Object
    {
        public var htmlText:String;
        public var mapId:int;
        public var x:int;
        public var y:int;
        public var type:String;
        public var subType:String;
        public var value1:int;
        public var value2:int;
        public var curNum:int;
        public var totalNum:int;
        public var data:Object;
        public var linkName:String;
        public var needBoot:Boolean = true;
        public var isLevelEnouth:Boolean = false;
        public var endSecond:int = -124567433;
        public var tips:String;
        public var needLevel:int = -1;
        public static const Point:String = "point";
        public static const boss:String = "boss";
        public static const npc:String = "npc";
        public static const self:String = "self";
        public static const drama:String = "drama";
        public static const escort:String = "escort";
        public static const introduce:String = "introduce";
        public static const branchGuide:String = "branchGuide";
        public static const pvp:String = "pvp";
        public static const fly:String = "fly";
        public static const NoTimer:int = -124567433;
        public static const BossTypeNoLimitBosssValue:int = -1;
        public static const subType_Escort:String = "escort";
        public static const subType_Challenge:String = "challenge";
        public static const subType_TaskAutoFight:String = "taskautofight";

        public function GLinkTextData()
        {
            return;
        }// end function

        public function get isShowNum() : Boolean
        {
            return this.totalNum > 0;
        }// end function

        public function equal(param1:GLinkTextData) : Boolean
        {
            if (param1.curNum != this.curNum)
            {
                return false;
            }
            if (param1.htmlText != this.htmlText)
            {
                return false;
            }
            if (param1.mapId != this.mapId)
            {
                return false;
            }
            if (param1.totalNum != this.totalNum)
            {
                return false;
            }
            if (param1.value1 != this.value1)
            {
                return false;
            }
            if (param1.value2 != this.value2)
            {
                return false;
            }
            if (param1.endSecond != this.endSecond)
            {
                return false;
            }
            if (param1.subType != this.subType)
            {
                return false;
            }
            if (param1.tips != this.tips)
            {
                return false;
            }
            return true;
        }// end function

        public function clone() : GLinkTextData
        {
            var _loc_1:* = new GLinkTextData();
            ClassTypesUtil.copyValue(_loc_1, this);
            return _loc_1;
        }// end function

        public function parse(param1:String) : void
        {
            var _loc_2:* = param1.split(GLinkTextConst.targetSpliter);
            this.mapId = int(_loc_2[0]);
            this.x = int(_loc_2[1]);
            this.y = int(_loc_2[2]);
            this.type = String(_loc_2[3]);
            this.value1 = int(_loc_2[4]);
            if (_loc_2.length >= 5)
            {
                this.value2 = int(_loc_2[5]);
            }
            return;
        }// end function

        public function get isLieMoTask() : Boolean
        {
            return this.subType == subType_TaskAutoFight;
        }// end function

        public function get isAutoFightType() : Boolean
        {
            return this.type == boss && this.value1 == BossTypeNoLimitBosssValue;
        }// end function

        public function sendClickLinkEvent() : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.TaskClickBranchGuide, [this, ""]));
            return;
        }// end function

        public function isNewCollectType() : Boolean
        {
            if (this.type == boss && this.subType != null && this.subType.length > 0)
            {
                return true;
            }
            return false;
        }// end function

        public function isEscortTaskType() : Boolean
        {
            return this.subType == subType_Escort;
        }// end function

        public function dispose() : void
        {
            this.htmlText = "";
            this.mapId = 0;
            this.x = 0;
            this.y = 0;
            this.type = "";
            this.value1 = 0;
            this.value2 = 0;
            this.needBoot = true;
            this.curNum = 0;
            this.totalNum = 0;
            this.data = null;
            this.isLevelEnouth = false;
            this.endSecond = GLinkTextData.NoTimer;
            this.subType = null;
            this.tips = null;
            this.needLevel = -1;
            return;
        }// end function

    }
}
